package com.cakeclient.database;


public class OrderTable extends DatabaseTable {
    public static final String TABLESNAME = "order_table";
    public static final String ID = "_id";
    public static final String REMOTE_ID = "remoteId";
    public static final String DATE = "date";
    public static final String DELIVERYDATE = "deliveryDate";
    public static final String ISTRACKED = "isTracked";
    public static final String CLIENTCOMMENTS = "clientcomments";
    public static final String CORPORATECOMMENTS = "corporatecomments";
    public static final String ID_CLIENT = "idClient";
    public static final String ID_PAYMENTYPE = "idPaymentType";
    public static final String ID_DELIVERYPLACE = "idDeliveryPlace";
    public static final String ID_BILLINGPLACE = "idBillingPlace";
    public static final String ID_DELIVERYTYPE = "idDeliveryType";


    public static final String[] ALLFIELDS = new String[]{
            ID,
            REMOTE_ID,
            DATE,
            DELIVERYDATE,
            ISTRACKED,
            CLIENTCOMMENTS,
            CORPORATECOMMENTS,
            ID_CLIENT,
            ID_PAYMENTYPE,
            ID_DELIVERYPLACE,
            ID_DELIVERYTYPE,
            ID_BILLINGPLACE

    };

    public static final String CREATE = "CREATE TABLE " + TABLESNAME
            + " ( "
            + ID + " INTEGER PRIMARY KEY AUTOINCREMENT , "
            + REMOTE_ID + " INTEGER ,"
            + DATE + " TIMESTAMP DEFAULT current_timestamp, "
            + DELIVERYDATE + " TIMESTAMP DEFAULT current_timestamp, "
            + ISTRACKED + " INTEGER , "
            + CLIENTCOMMENTS + " TEXT , "
            + CORPORATECOMMENTS + " TEXT , "
            + ID_CLIENT + " INTEGER , "
            + ID_PAYMENTYPE + " INTEGER , "
            + ID_DELIVERYPLACE + " INTEGER , "
            + ID_DELIVERYTYPE + " INTEGER , "
            + ID_BILLINGPLACE + " INTEGER ); ";


    private static DatabaseTable ourInstance = new OrderTable();


    @Override
    public String getTableName() {
        return TABLESNAME;
    }

    @Override
    public String[] getAllFields() {
        return ALLFIELDS;
    }

    @Override
    public String getCreate() {
        return CREATE;
    }

    public static DatabaseTable getInstance() {
        return ourInstance;
    }

    private OrderTable() {
    }
}
